<?php
$this->load->view($this->template->tpl_prefix_admin . 'include/header_nav');
$current_permission_group = NULL;
?>
<aside class="aside">
         <!-- START Sidebar (left)-->
         <nav class="sidebar">
            <!-- START user info-->
		<div class="item user-block row">
					<!-- START widget-->
					<div class="panel widget">
					   <div class="panel-body bg-primary text-center">
						  <p>
						   <a href="<?php echo admin_url();?>admin/profile" title="Chỉnh sửa thông tin cá nhân">
							 <img src="<?php echo image($this->admin->avatar, 'original');?>" alt="" class="img-rounded thumb96">
							 </a>
						  </p>
						  <p>
							 <strong><?php echo $this->admin->name;?> </strong><a href="<?php echo admin_url();?>admin/logout" title="Thoát" style="color: #fff;"><i class="fa fa-sign-out"></i></a>
							 <span><?php echo $this->admin->role_name;?></span>
						  </p>
					   </div>
					</div>
					<!-- END widget-->
				 </div>
                  
					 
            <!-- END user info-->
            <ul class="nav">
               <!-- START Menu-->
               <li class="<?php echo (current_url() == admin_url())?'active':'';?>">
                  <a href="<?php echo admin_url();?>" title="Dashboard" data-toggle="" class="no-submenu">
                     <em class="fa fa-dashboard"></em>
                     <span class="item-text">Dashboard</span>
                  </a>
               </li>
			   <?php
			   $sidebars = $this->permission->get_by_sidebar();
			   if($sidebars)
			   {
				   $groups = $sidebars['groups'];
				   foreach($groups as $group)
				   {
					$permissions = @$sidebars['permissions'][$group->pgroup_id];
					//prd($permissions);
			   ?>
               <li class="active">
                  <a href="javascript:void(0);" title="Forms" data-toggle="collapse-next" class="has-submenu">
                     <em class="fa <?php echo $group->pgroup_class;?>"></em>
                     <span class="item-text"><?php echo $group->pgroup_title;?></span>
                  </a>
                  <!-- START SubMenu item-->
				  <?php if($permissions)
					  	?>
                  <ul class="nav collapse<?php echo (current_url() == @$link)?' in':' in';?>">
                  <?php
                   foreach($permissions as $permission_key => $permission) {
					  	$link = admin_url().$permission->permission_sidebar_link.'/';
					  	$class= '';
					  	if($permission->permission_name == $this->current_permission)
					  	{

					  		$class= 'active';
					  		if($this->heading =='')
					  			$this->heading = $permission->permission_title;
					  		if($this->sub_heading =='')
					  			$this->sub_heading = $permission->permission_description;
					  		$current_permission_group = $group;
					  		$this->breadcrumbs->push($current_permission_group->pgroup_title, '/'.$permission->permission_sidebar_link.'/', 10);
					  		$this->breadcrumbs->push($this->heading, '/'.$permission->permission_sidebar_link.'/', 20);
					  	}
					  	?>
                     <li class="<?php echo $class;?>">
                        <a href="<?php echo $link;?>" title="<?php echo $permission->permission_description;?>" data-toggle="" class="no-submenu">
						<em class="fa <?php echo $permission->permission_sidebar_class;?>"></em>
                           <span class="item-text"><?php echo $permission->permission_title;?></span>
                        </a>
                     </li>
                     <?php } ?>
                  </ul>
				   
                  <!-- END SubMenu item-->
               </li>
			   <?php } ?>
			   <?php } ?>
               <!-- END Menu-->
            </ul>
         </nav>
         <!-- END Sidebar (left)-->
      </aside>
<?php
$this->load->view($this->template->tpl_prefix_admin . 'include/chat');
?>


 <section>
 <!-- START Page content - file leftcp-->
 <div class="content-wrapper">
	<h3><?php echo mb_strtoupper($this->heading);?>
	<small><?php //echo $this->sub_heading;?></small>
	</h3>
	<?php 
	
	
	echo $this->breadcrumbs->show(); ?>
	<div class="row">
	<div class="col-lg-12">
  